package com.foreknow.demo2;

import java.util.Scanner;

// 输入四位会员卡号,获取百位数字,判断是否为幸运会员(根据随机数)
public class test1 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int random = (int) (Math.random()*10);
        System.out.println("幸运数为:"+random);
        System.out.println("请输入会员卡号:");
        int card = input.nextInt();
        int i = (card/100)%10;
        if (i == random){
            System.out.println("该会员是幸运会员");
        }else{
            System.out.println("该会员不是幸运会员");
        }
    }
}
